int nToMMerge(int N, int M, int i, int j){
  int maskForN = ~(1 << {j+1) - 1) | (1<<i-1);
  int nWithMask = N & mmaskForN;
  
  return nWithMask | M<<i;
}